<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="dao.CategoriesDAO" %>
<%@page import="model.CategoriesModel" %>

<%--get categories list--%>
<c:set var="listCate" value="<%= CategoriesDAO.getAllCategories() %>"></c:set>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/style.css" />
<script type="text/javascript" src="js/boxOver.js"></script>

<div id="main_container">
    <div class="left_content">
        <div class="title_box">Login</div>
        <c:if test="${empty sessionScope.userID}" >
            <jsp:include page="../login.jsp" />
        </c:if>
        <c:if test="${not empty sessionScope.userID}" >
            <ul class="left_menu">
                <table cellpadding="2" cellspacing="2" bgcolor="" width="100%">
                    <tr>
                        <td align="left">Welcome: <font color="red">${sessionScope.fullname}</font></td>
                        <td align="center"><a href="logout.jsp">Logout</a></td>
                    </tr>
                    <tr align="right">
                        <td align="left">
                            AccountType: <br/> <font color="red">${sessionScope.role}</font>
                        </td>
                        <td align="center">
                            <a href="showcart.jsp"><img src="images/shoppingcart.png" alt="addToShoppingCard" border = "0" width="20px" height="20px"/></a>
                        </td>
                    </tr>
                </table>
            </ul>
        </c:if>

                    
        <div class="title_box">Categories</div>
        <ul class="left_menu">
            <c:forEach var="objCate" items="${listCate}">
                <li class="odd"><a href="showproduct.jsp?cateID=${objCate.id}"> ${objCate.cateName} </a></li>
            </c:forEach>
        </ul>

        
        <%--<div class="border_box"></div>
        <div class="title_box"></div>
        <div class="border_box"></div>--%>
    </div>
</div>

